package com.warehouse.service.impl;

import com.warehouse.dao.UserDao;
import com.warehouse.dao.impl.UserDaoImpl;
import com.warehouse.domain.User;
import com.warehouse.service.LoginService;


public class LoginServiceImpl implements LoginService {
	UserDao userDao = new UserDaoImpl();
	
	/**
	 * 用户登录函数
	 * @param  userName  用户名
	 * @param  password  密码
	 * @return 登录是否成功
	 */
	@Override
	public boolean login(String userName, String password) {
		User user = userDao.getObjectByUserName(userName);
		if(user==null)
			return false;
		if(password.trim().equals(user.getPassword()))
			return true;
		else
			return false;
	}
}
